package Server.Login.Controller;

import Server.Login.View.*;
import Server.Login.Model.*;
import Server.Login.Controller.*;
import Server.ServerMainFrame.ServerMainFrameController.ServerMainFrameController;
import Server.ServerMainFrame.ServerMainFrameModel.ServerMainFrameModel;
import Server.ServerMainFrame.ServerMainFrameView.ServerMainFrameView;

public class ServerLoginController 
{
    public void initialize()
    {
    	getView().loginButton.addActionListener(new LoginButtonListener(view, model, this));
    	getView().exitButton.addActionListener(new ExitButtonListener(view, model));
    	getView().loadFileButton.addActionListener(new LoadFileButtonListener(view, model));
    }
    public void setViewAndModel(ServerLoginView view, ServerLoginModel model)
    {
    	this.view = view;
    	this.model = model;
    }
    
    public ServerLoginView getView()
    {
        return view;	
    }
    public ServerLoginModel getModel()
    {
        return model;
    }
    
    public void runMainFrame()
    {
    	 ServerMainFrameView serverMainFrameView = new ServerMainFrameView();
	     ServerMainFrameModel serverMainFrameModel = new ServerMainFrameModel();
	     ServerMainFrameController serverMainFrameController = new ServerMainFrameController();
	     serverMainFrameModel.setViewAndController(serverMainFrameView, serverMainFrameController);
	     serverMainFrameController.setViewAndModel(serverMainFrameView, serverMainFrameModel);
	     serverMainFrameModel.initialize(model, this);
	     serverMainFrameController.initialize(model, this);
    }
    
    
    private ServerLoginView view;
    private ServerLoginModel model;
}
